package com.fms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fms.mapper.SysDeptMapper;
import com.fms.entity.SysDept;
import com.fms.service.SysDeptService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements SysDeptService {

    private final SysDeptMapper sysDeptMapper;
    @Override
    //查询指定部门信息
    public SysDept getSysDeptById(String id) {
        LambdaQueryWrapper<SysDept> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysDept::getId,id);
        return this.getOne(queryWrapper);
    }

    @Override
    //获取部门列表
    public List<SysDept> getDeptList() {
        LambdaQueryWrapper<SysDept> wrapper = new LambdaQueryWrapper<>();
        return sysDeptMapper.selectList(wrapper);
    }

    @Override
    //删除部门信息
    public void deleteDeptById(String id) {
        sysDeptMapper.deleteById(id);
    }
}
